home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / c / library / dos / diverses / leda / incl / interval.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-11-15  |  1.5 KB  |  70 lines

  1. /*******************************************************************************
  2. +
  3. +  LEDA  2.1.1                                                 11-15-1991
  4. +
  5. +
  6. +  interval_set.h
  7. +
  8. +
  9. +  Copyright (c) 1991  by  Max-Planck-Institut fuer Informatik
  10. +  Im Stadtwald, 6600 Saarbruecken, FRG     
  11. +  All rights reserved.
  12. *******************************************************************************/
  13.  
  14.  
  15.  
  16.  
  17. #ifndef INTERVALL_SET_H
  18. #define INTERVALL_SET_H
  19.  
  20. #include <LEDA/d2_dictionary.h>
  21.  
  22. typedef dic2_item is_item;
  23.  
  24. declare(list,is_item)
  25.  
  26.  
  27. declare3(d2_dictionary,real,real,ent) 
  28.  
  29.  
  30. struct Interval_Set : public d2_dictionary(real,real,ent) {
  31.  
  32. real    left(is_item it) { return key1(it); }
  33. real    right(is_item it){ return key2(it); }
  34.  
  35. list(is_item)  intersection(real, real);
  36.  
  37.  Interval_Set()  {}
  38. ~Interval_Set()  {}
  39. };
  40.  
  41.  
  42.  
  43. #define interval_set(itype) name2(itype,interval_set)
  44.  
  45.  
  46. #define interval_setdeclare(itype)\
  47. \
  48. struct interval_set(itype) : public Interval_Set{\
  49. \
  50. itype   inf(is_item it)  { return itype(Interval_Set::inf(it)); }\
  51. \
  52. is_item insert(real x, real y, itype i)\
  53.                          { return Interval_Set::insert(x,y,Copy(i)); }\
  54. \
  55. void    change_inf(is_item it, itype i)\
  56.                          { Interval_Set::change_inf(it,Copy(i)); }\
  57. \
  58. list(is_item)  intersection(real x, real y)\
  59.                          { return Interval_Set::intersection(x,y); }\
  60. \
  61.  interval_set(itype)()  {}\
  62. ~interval_set(itype)()  {}\
  63. };
  64.  
  65. #define forall_is_items(i,D) forall_dic2_items(i,D)
  66.  
  67. #endif
  68.  
  69.